@import '@devui/theme/styles-var/devui-var.scss';

$tree-select-input-height: 28px;
$tree-select-dropdown-max-height: 300px;
$tree-select-item-min-height: 36px;
$tree-select-item-font-size: 16px;

.#{$devui-prefix}-tree-select {
  position: relative;
  width: 100%;
}

.#{$devui-prefix}-tree-select-disabled {
  cursor: not-allowed;
  background-color: $devui-disabled-bg;
  border-color: $devui-disabled-line;
  color: $devui-disabled-text;

  .#{$devui-prefix}-tree-select-input {
    cursor: not-allowed;
    background-color: $devui-disabled-bg;
    border-color: $devui-disabled-line;
    color: $devui-disabled-text;
  }

  .#{$devui-prefix}-tree-select-arrow {
    cursor: not-allowed;
    color: $devui-disabled-text;
  }
}

.#{$devui-prefix}-tree-select-open {
  .#{$devui-prefix}-tree-select-arrow {
    transform: rotate3d(0, 0, 1, 180deg);
  }
}

.#{$devui-prefix}-tree-select-input {
  cursor: pointer;
  width: 100%;
  height: $tree-select-input-height;
  padding: 0 10px;
  color: $devui-text;
  border: 1px solid $devui-form-control-line;
  border-radius: $devui-border-radius;
  outline: none;
  background-color: $devui-base-bg;
  overflow: auto;

  &:empty::before {
    color: lightgrey;
    content: attr(placeholder);
    vertical-align: middle;
  }
}

.#{$devui-prefix}-tree-select-value {
  display: inline-block;
  height: 80%;
  vertical-align: middle;
}

.#{$devui-prefix}-tree-select-value-enableLabelization {
  padding: 0 10px;
  margin: 2px 10px 2px 0;
  background-color: $devui-icon-fill;
}

.#{$devui-prefix}-tree-select-dropdown {
  border-radius: $devui-border-radius;
  background: $devui-base-bg;
  box-shadow: 0 2px 5px 0 $devui-shadow;
}

.#{$devui-prefix}-tree-select-dropdown-list {
  max-height: $tree-select-dropdown-max-height;
  overflow-y: auto;
  padding: 0;
  margin: 0;
}

.#{$devui-prefix}-tree-select-item {
  font-size: $tree-select-item-font-size;
  display: inline-flex;
  min-height: $tree-select-item-min-height;
  line-height: 1.5;
  width: 100%;
  padding: 10px;
  clear: both;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 0;
  color: $devui-text;
  cursor: pointer;
  align-items: center;

  &:hover:not(.active):not(.disabled) {
    color: $devui-list-item-hover-text;
    background-color: $devui-list-item-hover-bg;
  }
}

.#{$devui-prefix}-tree-select-clearable {
  position: relative;

  &:hover {
    .#{$devui-prefix}-tree-select-clear {
      display: inline-flex;
    }

    .#{$devui-prefix}-tree-select-arrow {
      display: none;
    }
  }
}

.#{$devui-prefix}-tree-select-notclearable {
  position: relative;
}

.#{$devui-prefix}-tree-select-clear,
.#{$devui-prefix}-tree-select-arrow {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: $tree-select-input-height;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.#{$devui-prefix}-tree-select-clear {
  display: none;

  &:hover {
    cursor: pointer;
    color: $devui-icon-fill-active;
  }
}
